home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / vdisrc12 / vdiinqr3.s < prev    next >
Text File  |  1990-11-23  |  7KB  |  178 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* VDIFAST Public Domain VDI bindings.
  5. ;*
  6. ;*========================================================================
  7.  
  8.           .iif      !(^^macdef VContrl),.include  "vdimacro.s"
  9.           
  10. ;*************************************************************************
  11. ;*
  12. ;* Inquiry functions.
  13. ;*  Text- and character-related functions.
  14. ;*
  15. ;*************************************************************************
  16.  
  17. ;*------------------------------------------------------------------------
  18. ;* Inquire text attributes.
  19. ;*------------------------------------------------------------------------
  20.           
  21. _vqt_attributes::
  22.           .cargs    #8,.handle.w,.attrib.l
  23.           link      a6,#0
  24.  
  25.           VContrl   #38
  26.           
  27.           move.l    .attrib(a6),a0
  28.           pea       12(a0)              ;* -> ptsout
  29.           move.l    a0,-(sp)            ;* -> ptsout
  30.           subq.l    #8,sp               ;* -> ptsout
  31.           pea       16(sp)              ;* -> contrl
  32.  
  33.           jmp       vdicall
  34.           
  35. ;*------------------------------------------------------------------------
  36. ;* Inquire text extent.
  37. ;*------------------------------------------------------------------------
  38.           
  39. _vqt_extent::
  40.           .cargs    #8,.handle.w,.string.l,.extent.l
  41.           link      a6,#0
  42.  
  43.           move.l    .string(a6),a0      ;* Get pointer to string.
  44.           moveq.l   #0,d0               ;* Zero out string length counter.
  45. .strcnt:                                ;* Count up length of string...
  46.           tst.b     (a0)+               ;* Found end yet?
  47.           beq.s     .strend             ;* Yep, go integerize it.
  48.           addq.w    #1,d0               ;* Nope, add 1 to counter,
  49.           bra.s     .strcnt             ;* and keep looking.
  50. .strend:
  51.           move.w    d0,d1               ;* Prime loop counter.
  52.           moveq.l   #0,d2               ;* Nice clean register.
  53. .strcpy:                                ;* Copy the string to the stack,
  54.           move.b    -(a0),d2            ;* with each string byte in the
  55.           move.w    d2,-(sp)            ;* low byte of each stack word,
  56.           dbra      d1,.strcpy          ;* which is how VDI likes to see it.
  57.           
  58.           move.l    sp,a0               ;* Save pointer to stacked string.
  59.           
  60.           VContrl   #116,,,d0
  61.           
  62.           move.l    .extent(a6),-(sp)   ;* -> ptsout
  63.           subq.l    #8,sp               ;* -> intout
  64.           move.l    a0,-(sp)            ;* -> intin
  65.           pea       16(sp)              ;* -> contrl
  66.  
  67.           jmp       vdicall
  68.           
  69. ;*------------------------------------------------------------------------
  70. ;* Inquire character cell width.
  71. ;*------------------------------------------------------------------------
  72.           
  73. vqt_width::
  74.           .cargs    #8,.handle.w,.character.w,.cellw.l,.left.l,.right.l
  75.           link      a6,#-14             ;* Allocate intout[1], ptsout[6].
  76.           
  77.           VContrl   #117,,,#1
  78.           
  79.           pea       -12(a6)             ;* -> ptsout
  80.           pea       -14(a6)             ;* -> intout
  81.           subq.l    #4,sp               ;* -> ptsin
  82.           pea       .character(a6)      ;* -> intin
  83.           pea       16(sp)              ;* -> contrl
  84.  
  85.           moveq.l   #$73,d0
  86.           move.l    sp,d1
  87.           trap      #2
  88.           
  89.           move.l    .cellw(a6),a0       ;* Return cell width
  90.           move.w    -12(a6),(a0)        ;* from ptsout[0].
  91.           move.l    .right(a6),a0       ;* Return cell right delta
  92.           move.w    -8(a6),(a0)         ;* from ptsout[2].
  93.           move.l    .left(a6),a0        ;* Return cell left delta
  94.           move.w    -4(a6),(a0)         ;* from ptsout[4].
  95.           move.w    -14(a6),d0          ;* Return status from intout[0].
  96.  
  97.           unlk      a6
  98.           rts
  99.  
  100. ;*------------------------------------------------------------------------
  101. ;* Inquire font face name and index.
  102. ;*------------------------------------------------------------------------
  103.           
  104. _vqt_name::
  105.           .cargs    #8,.handle.w,.element.w,.namestr.l
  106.           link      a6,#-66             ;* Allocate intout[33].
  107.           
  108.           VContrl   #130,,,#1
  109.           
  110.           subq.l    #4,sp               ;* -> ptsout
  111.           pea       -66(a6)             ;* -> intout
  112.           subq.l    #4,sp               ;* -> ptsin
  113.           pea       .element(a6)        ;* -> intin
  114.           pea       16(sp)              ;* -> contrl
  115.  
  116.           moveq.l   #$73,d0
  117.           move.l    sp,d1
  118.           trap      #2
  119.  
  120.           lea       -66(a6),a0          ;* Pointer to intout.
  121.           move.l    .namestr(a6),a1     ;* Pointer to caller's string.
  122.           move.w    (a0)+,d0            ;* Return status from intout[0].
  123. .strloop:
  124.           move.w    (a0)+,d1            ;* Return normal string from
  125.           move.b    d1,(a1)+            ;* intout[1-32].  Copy low byte of
  126.           bne.s     .strloop            ;* each word to string byte.
  127.           
  128.           unlk      a6
  129.           rts
  130.  
  131. ;*------------------------------------------------------------------------
  132. ;* Inquire font information.
  133. ;*------------------------------------------------------------------------
  134.  
  135. _v_qt_fontinfo::
  136.           .cargs    #8,.handle.w,.minade.l,.maxade.l,.dist.l,.maxw.l,.effects.l
  137.           link      a6,#-24             ;* Allocate intout[2], ptsout[5].
  138.  
  139.           VContrl   #131
  140.           
  141.           pea       -20(a6)             ;* -> ptsout
  142.           pea       -24(a6)             ;* -> intout
  143.           subq.l    #8,sp               ;* -> ptsin
  144.           pea       16(sp)              ;* -> contrl
  145.  
  146.           moveq.l   #$73,d0
  147.           move.l    sp,d1
  148.           trap      #2
  149.           
  150.           lea       -24(a6),a0          ;* Point to intout.
  151.           move.l    .minade(a6),a1      ;* Return minADE
  152.           move.w    (a0)+,(a1)          ;* from intout[0].
  153.           move.l    .maxade(a6),a1      ;* Return maxADE
  154.           move.w    (a0)+,(a1)          ;* from, intout[1].
  155.  
  156.           move.l    .maxw(a6),a1        ;* Return maxwidth
  157.           move.w    (a0)+,(a1)          ;* from ptsout[0].
  158.           
  159.           move.l    a2,d2               ;* Save a2 for Laser C compatibility.
  160.           move.l    .dist(a6),a1        ;* Pointer to distance
  161.           move.l    .effects(a6),a2     ;* Pointer to effects
  162.           
  163.           move.w    (a0)+,(a1)+         ;* dist[0] = ptsout[1]
  164.           move.w    (a0)+,(a2)+         ;* eff[0]  = ptsout[2]
  165.           move.w    (a0)+,(a1)+         ;* dist[1] = ptsout[3]
  166.           move.w    (a0)+,(a2)+         ;* eff[1]  = ptsout[4]
  167.           move.w    (a0)+,(a1)+         ;* dist[2] = ptsout[5]
  168.           move.w    (a0)+,(a2)+         ;* eff[2]  = ptsout[6]
  169.           move.w    (a0)+,(a1)+         ;* dist[3] = ptsout[7]
  170.           tst.w     (a0)+               ;* notused - pstout[8] 
  171.           move.w    (a0),(a1)           ;* dist[4] = ptsout[9]
  172.           
  173.           move.l    d2,a2               ;* Restore a2.
  174.           unlk      a6
  175.           rts
  176.  
  177. ;       end of code
  178.